home *** CD-ROM | disk | FTP | other *** search
Wrap
RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) NNNNaaaammmmeeee RWeistream - Rogue Wave library class SSSSyyyynnnnooooppppssssiiiissss #include <rw/estream.h> RWeistream estr(cin); // Construct an RWeistream, // using cin's streambuf DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn Class RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm specializes the base class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm to restore values previously stored by RRRRWWWWeeeeoooossssttttrrrreeeeaaaammmm. The endian streams, RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm and RRRRWWWWeeeeoooossssttttrrrreeeeaaaammmm, offer an efficient compromise between the portable streams (RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm, RRRRWWWWppppoooossssttttrrrreeeeaaaammmm) and the binary streams (RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm, RRRRWWWWbbbboooossssttttrrrreeeeaaaammmm). By compensating for differences in big-endian vs. little-endian formats, as well as sizes of the various integral types, the endian streams offer portability without incurring the stream-size overhead of translating values into a series of printable characters. For example, data stored in little-endian format by an RRRRWWWWeeeeoooossssttttrrrreeeeaaaammmm object in a DOS program can be retrieved by an RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm object on any of several machines, regardless of its native endian format or the sizes of its integral types. Endian streams will work properly when shared among a group of platforms that: Share a common size and representation (apart from endian format) for types ffffllllooooaaaatttt and ddddoooouuuubbbblllleeee; Use two's complement format for negative integral values. As with the portable streams, care must be taken when storing or retrieving variables of type char. Endian stream methods treat chars as numbers except where the method description explicitly states that the char is being treated, instead, as a character. See the entry for RRRRWWWWppppoooossssttttrrrreeeeaaaammmm for an example of this distinction. Data stored in an integral type on one platform may be too large to fit into that type on a receiving platform. If so, the RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm's failbit will be set.Endian streams can be interrogated as to the stream state using member functions ggggoooooooodddd(((()))), bbbbaaaadddd(((()))), eeeeooooffff(((()))), etc. PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee None. EEEExxxxaaaammmmpppplllleeee See RRRRWWWWeeeeoooossssttttrrrreeeeaaaammmm for an example of how the file "ddddaaaattttaaaa....ddddaaaatttt" might be PPPPaaaaggggeeee 1111 RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) created. PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm(streambuf* s); Construct an RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm from the ssssttttrrrreeeeaaaammmmbbbbuuuuffff ssss. For DOS, this ssssttttrrrreeeeaaaammmmbbbbuuuuffff must have been created in binary mode. Throw exception RRRRWWWWSSSSttttrrrreeeeaaaammmmEEEErrrrrrrr if not a valid endian stream. RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm(istream& str); Construct an RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm using the ssssttttrrrreeeeaaaammmmbbbbuuuuffff associated with the iiiissssttttrrrreeeeaaaammmm ssssttttrrrr. For DOS, the ssssttttrrrr must have been opened in binary mode. Throw exception RRRRWWWWSSSSttttrrrreeeeaaaammmmEEEErrrrrrrr if not a valid endian stream. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss virtual int ggggeeeetttt(); virtual RWvistream& ggggeeeetttt(char& c); virtual RWvistream& ggggeeeetttt(unsigned char& c); virtual RWvistream& ggggeeeetttt(char* v, size_t N); virtual RWvistream& ggggeeeetttt(unsigned char* v, size_t N); Inherited from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. virtual RWvistream& ggggeeeetttt(wchar_t& wc); Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. Get the next wwwwcccchhhhaaaarrrr____tttt from the input stream and store it in wwwwcccc,,,, compensating for any differences in size or endian format between the stream and the current environment. Set the failbit if the value in the stream is too large to be stored in wwwwcccc. virtual RWvistream& ggggeeeetttt(wchar_t* v, size_t N); Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. Get a vector of wwwwcccchhhhaaaarrrr____tttts and store it in the array beginning at vvvv, compensating for any differences in size or endian format between the stream and the current environment. If the restore stops prematurely, store whatever possible in vvvv, and set the failbit. Also set the failbit if any values in the stream are too large to be stored in an element of vvvv. PPPPaaaaggggeeee 2222 RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) virtual RWvistream& ggggeeeetttt(double* v, size_t N); Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. Get a vector of ddddoooouuuubbbblllleeees and store them in the array beginning at vvvv, compensating for any difference in endian format between the stream and the current environment. If the restore stops prematurely, store whatever possible in vvvv, and set the failbit. virtual RWvistream& ggggeeeetttt(float* v, size_t N); Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. Get a vector of ffffllllooooaaaatttts and store them in the array beginning at vvvv, compensating for any difference in endian format between the stream and the current environment. If the restore stops prematurely, store whatever possible in vvvv, and set the failbit. virtual RWvistream& ggggeeeetttt(int* v, size_t N); Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. Get a vector of iiiinnnntttts and store them in the array beginning at vvvv, compensating for any differences in size or endian format between the stream and the current environment. If the restore stops prematurely, store whatever possible in vvvv, and set the failbit. Also set the failbit if any values in the stream are too large to be stored in an element of vvvv. virtual RWvistream& ggggeeeetttt(long* v, size_t N); Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. Get a vector of lllloooonnnnggggs and store them in the array beginning at vvvv, compensating for any differences in size or endian format between the stream and the current environment. If the restore stops prematurely, store whatever possible in vvvv, and set the failbit. Also set the failbit if any values in the stream are too large to be stored in an element of vvvv. virtual RWvistream& ggggeeeetttt(short* v, size_t N); Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. Get a vector of sssshhhhoooorrrrtttts and store them in the array beginning at vvvv, compensating for any differences in size or endian format between the stream and the current environment. If the restore stops prematurely, store whatever possible in vvvv, and set the failbit. Also set the failbit if any values in the stream are too large to be stored in an element of vvvv. PPPPaaaaggggeeee 3333 RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) virtual RWvistream& ggggeeeetttt(unsigned short* v, size_t N); Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. Get a vector of uuuunnnnssssiiiiggggnnnneeeedddd sssshhhhoooorrrrtttts and store them in the array beginning at vvvv. If the restore stops prematurely, store whatever possible in vvvv, and set the failbit. Also set the failbit if any values in the stream are too large to be stored in an element of vvvv. virtual RWvistream& ggggeeeetttt(unsigned int* v, size_t N); Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. Get a vector of uuuunnnnssssiiiiggggnnnneeeedddd iiiinnnntttts and store them in the array beginning at vvvv, compensating for any differences in size or endian format between the stream and the current environment. If the restore stops prematurely, store whatever possible in vvvv, and set the failbit. Also set the failbit if any values in the stream are too large to be stored in an element of vvvv. virtual RWvistream& ggggeeeetttt(unsigned long* v, size_t N); Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. Get a vector of uuuunnnnssssiiiiggggnnnneeeedddd lllloooonnnnggggs and store them in the array beginning at vvvv, compensating for any differences in size or endian format between the stream and the current environment If the restore stops prematurely, store whatever possible in vvvv, and set the failbit. Also set the failbit if any values in the stream are too large to be stored in an element of vvvv. virtual RWvistream& ggggeeeettttSSSSttttrrrriiiinnnngggg(char* s, size_t N); Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. Restores a character string from the input stream and stores it in the array beginning at ssss. The function stops reading at the end of the string or after NNNN----1111 characters, whichever comes first. If the latter, then the failbit of the stream will be set, and the remaining characters of the string will be extracted from the stream and thrown away. In either case, the string will be terminated with a null byte. If the size of the string is too large to be represented by a variable of type ssssiiiizzzzeeee____tttt in the current environment, the badbit of the stream will be set, and no characters will be extracted. Note that the elements of the string are treated as characters, not numbers. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(char& c); PPPPaaaaggggeeee 4444 RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. Get the next cccchhhhaaaarrrr from the input stream and store it in cccc. Note that cccc is treated as a character, not a number. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(wchar_t& wc); Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. Get the next wwwwcccchhhhaaaarrrr____tttt from the input stream and store it in wwwwcccc,,,, compensating for any differences in size or endian format between the stream and the current environment. Set the failbit if the value in the stream is too large to be stored in wwwwcccc. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(double& d); Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. Get the next ddddoooouuuubbbblllleeee from the input stream and store it in dddd,,,, compensating for any difference in endian format between the stream and the current environment. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(float& f); Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. Get the next ffffllllooooaaaatttt from the input stream and store it in ffff,,,, compensating for any difference in endian format between the stream and the current environment. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(int& i); Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. Get the next iiiinnnntttt from the input stream and store it in iiii,,,, compensating for any differences in size or endian format between the stream and the current environment. Set the failbit if the value in the stream is too large to be stored in iiii. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(long& l); Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. Get the next lllloooonnnngggg from the input stream and store it in llll,,,, compensating for any differences in size or endian format between the stream and the current environment. Set the failbit if the value in the stream is too large to be stored in llll. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(short& s); Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. Get the next sssshhhhoooorrrrtttt from the input stream and store it in ssss,,,, compensating for any differences in size or PPPPaaaaggggeeee 5555 RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) endian format between the stream and the current environment. Set the failbit if the value in the stream is too large to be stored in ssss. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(unsigned char& c); Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. Get the next uuuunnnnssssiiiiggggnnnneeeedddd cccchhhhaaaarrrr from the input stream and store it in cccc. Note that cccc is treated as a character, not a number. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(unsigned short& s); Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. Get the next uuuunnnnssssiiiiggggnnnneeeedddd sssshhhhoooorrrrtttt from the input stream and store it in ssss,,,, compensating for any differences in size or endian format between the stream and the current environment. Set the failbit if the value in the stream is too large to be stored in ssss. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(unsigned int& i); Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. Get the next uuuunnnnssssiiiiggggnnnneeeedddd iiiinnnntttt from the input stream and store it in iiii,,,, compensating for any differences in size or endian format between the stream and the current environment. Set the failbit if the value in the stream is too large to be stored in iiii. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(unsigned long& l); Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. Get the next uuuunnnnssssiiiiggggnnnneeeedddd lllloooonnnngggg from the input stream and store it in llll,,,, compensating for any differences in size or endian format between the stream and the current environment. Set the failbit if the value in the stream is too large to be stored in llll. RRRRWWWWeeeeoooossssttttrrrreeeeaaaammmm::::::::EEEEnnnnddddiiiiaaaannnnssssttttrrrreeeeaaaammmmEEEEnnnnddddiiiiaaaannnn(); Return the endian format (RRRRWWWWeeeeoooossssttttrrrreeeeaaaammmm::::::::BBBBiiiiggggEEEEnnnnddddiiiiaaaannnn or RRRRWWWWeeeeoooossssttttrrrreeeeaaaammmm::::::::LLLLiiiittttttttlllleeeeEEEEnnnnddddiiiiaaaannnn) of numeric values, as represented in the stream. size_t ssssttttrrrreeeeaaaammmmSSSSiiiizzzzeeeeooooffffIIIInnnntttt(); Return the size of iiiinnnntttts, as represented in the stream. PPPPaaaaggggeeee 6666 RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) size_t ssssttttrrrreeeeaaaammmmSSSSiiiizzzzeeeeooooffffLLLLoooonnnngggg(); Return the size of lllloooonnnnggggs, as represented in the stream. size_t ssssttttrrrreeeeaaaammmmSSSSiiiizzzzeeeeooooffffSSSShhhhoooorrrrtttt(); Return the size of sssshhhhoooorrrrtttts, as represented in the stream. size_t ssssttttrrrreeeeaaaammmmSSSSiiiizzzzeeeeooooffffSSSSiiiizzzzeeeeTTTT(); Return the size of ssssiiiizzzzeeee____tttts, as represented in the stream. size_t ssssttttrrrreeeeaaaammmmSSSSiiiizzzzeeeeooooffffWWWWcccchhhhaaaarrrr(); Returns the size of wwwwcccchhhhaaaarrrr____tttts, as represented in the stream. PPPPaaaaggggeeee 7777